<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="author" content="ISUX">
    <meta name="layout" content="main_mobile">
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
   <link rel="stylesheet" href="${resource(dir: 'css', file: 'project_list.css')}" type="text/css">
   <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
   <script type="text/javascript" src="${resource(dir: 'js', file: 'jquery-1.10.2.js')}" ></script>  
    <link rel="stylesheet" type="text/css" href="../frozen/css/frozen.css">
    <link rel="stylesheet" type="text/css" href="../css/default.css">
    <title>爱心池</title>
    <link rel="stylesheet" type="text/css" href="../css/fund_pool.css">
</head>
<body>
    <div class="ui-footer ui-footer-navi ui-btn-group ui-border-t">
         <a href="/scfire/index/pc_index/" ><i class="i1"></i><div>首页</div></a>
        <a href="/scfire/project/fundPoolList" class="active"><i class="i2"></i><div>爱心池</div></a>
    </div>
    <section class="ui-container">
        <div class="fp-top-link">
            <a href="http://mp.weixin.qq.com/s?__biz=MzAxNjM5NzExOQ==&mid=402294711&idx=1&sn=47e8e3a27459da1cb142d8a957b3ec30#rd" class="ui-arrowlink">我要开通</a>
        </div>
        <ul class="ui-list fb-list" id="fundpools">
        <%--<g:each in="${foolLists}" var="${foolList}">
        
            <li class="ui-border-t">
                <a href="/scfire/project/fundpooldetail?fundPoolid=${foolList.id}">
                    <div class="ui-list-img">
                        <span style="background-image:url(/scfire/project/imgRead?img=${foolList.coverPic})">
                            <span>${foolList.type}</span>
                        </span>
                    </div>
                    <div class="ui-list-info">
                        <h4 class="ui-nowrap">${foolList.name}</h4>
                        <p class="ui-nowrap">${foolList.description}</p>
                        <p class="ui-nowrap">助力 <em>${foolList.totalProject}</em> 个项目 <span>累计配捐 <em><g:formatNumber number="${foolList?.totaldonate}" format="0.00"/></em> 万元</span></p>
                    </div>
                </a>
            </li>
           </g:each>
        --%></ul>
        <div class="ui-line-more" id="more">
             <p  id='week'>加载完成</p>
        </div>
    </section>
    <script src="../frozen/lib/zeptojs/zepto.min.js"></script>
    <script src="../frozen/js/frozen.js"></script>
    <script>
    var finalOffset=20
	var offset = 0
	ajaxRead(); 	  
    function ajaxRead()  
    { 
        var html="";  
        $.ajax({  
              type:'get',  
              dataType:'json',
	          url:'/scfire/project/fundPoolList?format=json&offset='+offset,  
              beforeSend:function(){console.log('loading...');$("#week").html('加载中...');},  
              success:function(data){ 
            	  			$.each(data,function(i,item){
            	  				offset++
                           //alert('OK?!...')                             
                           html += "<li class='ui-border-t'>"
                           html += "<a href='/scfire/project/fundpooldetailPC?fundPoolid="+item.id+"'>"
                           html += "<div class='ui-list-img'>"
                       	   html += "<span style='background-image:url(/scfire/project/imgRead?img="+item.coverPic+")'>"
                           html +=" <span>"+item.type+"</span>"
                           html +="</span>"
                  	       html +="</div>"
                           html +="<div class='ui-list-info'>"
                      	   html +="<h4 class='ui-nowrap'>"+item.name+"</h4>"
                   	       html +="<p class='ui-nowrap'>"+item.description+"</p>"
                           html +=" <p class='ui-nowrap'>助力 <em>"+item.totalProject+"</em> 个项目 <span>累计配捐 <em>"+item.totaldonate.toFixed(2)+"</em> 元</span></p>"  	   
                           html +="</div>"
                       	   html +="</a>"
                           html +="</li>"
                            });
                            $("#fundpools").append($(html));
                            if(data.length<finalOffset){       				
                 				$("#week").html("已经到底了")
                 				$("#week").removeAttr("onclick");
                 				
                     		}else{
                	            $("#week").html("加载更多")
                	            $("#week").attr("onclick","ajaxRead()");
                         		}
                           
              },  
              complete:function(){console.log('mission complete.')}  ,
              error:function(data){
	              console.log("error")
            	  $("#week").html('已经到底了');
              }
  
        });  
    }  

    </script>
</body>
</html>